<template>
  <div class="share-device">
    <div class="qrcode" ref="qrCodeUrl"></div>
  </div>
</template>
<script>
  import QRCode from 'qrcodejs2'

  export default {
    data() {
      return {};
    },
    components: {},
    methods: {
      creatQrCode() {
        new QRCode(this.$refs.qrCodeUrl, {
          text: 'xxxx', // 需要转换为二维码的内容
          width: 300,
          height: 300,
          colorDark: '#000000',
          colorLight: '#ffffff',
          correctLevel: QRCode.CorrectLevel.H
        })
      },
    },
    mounted() {
      this.creatQrCode();
    },
  }
</script>
<style lang="css" scoped>
  .qrcode {
    display: inline-block;
  }

  img {
    width: 332px;
    height: 332px;
    background-color: #fff;
  }

  .share-device {
    margin-top: 10%;
    text-align: center;
  }

</style>